<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/
        // 先排序，然后双指针解决
        // 还有更好的方法，先不想了，通过就行
        // 还可以暴力哈希解决
        var singleNumbers = function(nums) {
            let res = []
            nums.sort((a, b) => {
                return a - b;
            })
            let p = 0, q = 1;
            while (p <= nums.length - 1) {
                if (nums[p] == nums[q]) {
                    p += 2;
                    q += 2;
                } else {
                    res.push(nums[p]);
                    p++;
                    q++;
                }
            }
            return res
        };
        singleNumbers([4, 1, 4, 6])
        singleNumbers([1,2,10,4,1,4,3,3])
    </script>
</body>
</html>